#10 new
phipster

uninitialized constant Authorization::AasmRoles::AASM (NameError)

Reported by phipster | August 25th, 2008 @ 04:19 PM

Hi, I'm running into problems when trying to get restful_authentication with the --aasm option working. I am a Rails newbie. I performed the following steps from the the instructions at http://github.com/technoweenie/r... to create a sample site using restful authentication with AASM.

  1. Installed the restful_authentication plugin: git clone git://github.com/technoweenie/restful-authentication.git restful_authentication

  2. Installed the rubyist-aasm gem following the instructions provided there, i.e. sudo gem install rubyist-aasm
    I believe the aasm gem was installed correctly, because I can load it from irb or script/console. I was also able to execute the test steps outlined here by Scott Barron with this result:

    irb(main):001:0> require 'rubygems'
    => true
    irb(main):002:0> require 'aasm'
    => true
    irb(main):003:0> class Conversation
    irb(main):004:1> include AASM
    irb(main):005:1> aasm_initial_state :new
    irb(main):006:1> aasm_state :new
    irb(main):007:1> aasm_state :read
    irb(main):008:1> aasm_event :view do
    irb(main):009:2* transitions :to => :read, :from => [:new]
    irb(main):010:2> end
    irb(main):011:1> end
    => #Proc:0xb7b3fd14@/usr/local/lib/ruby/gems/1.8/gems/rubyist-aasm-2.0.2/lib/aasm.rb:59
    irb(main):012:0> Conversation.new.view!
    => true
    irb(main):013:>
    

  3. Generated the restful auth code: ./script/generate authenticated user sessions --aasm

  4. Updated routes.rb and environment.rb as directed

  5. The following error stack was produced when I ran ./script/server (sorry it's so long). If I commented out the user_observer statement in environment.rb, the application started up OK, but died in User#new with the same error "uninitialized constant Authorization::AasmRoles::AASM":

=> Booting Mongrel (use 'script/server webrick' to force WEBrick)
=> Rails 2.1.0 application starting on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
** Starting Mongrel listening at 0.0.0.0:3000
** Starting Rails with development environment...
Exiting
/usr/local/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/active_support/dependencies.rb:275:in `load_missing_constant': uninitialized constant Authorization::AasmRoles::AASM (NameError)
        from /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/active_support/dependencies.rb:467:in `const_missing'
        from /mnt/win/rails/t4h_promo/vendor/plugins/restful_authentication/lib/authorization/aasm_roles.rb:11:in `included'
        from /mnt/win/rails/t4h_promo/vendor/plugins/restful_authentication/lib/authorization/aasm_roles.rb:9:in `class_eval'
        from /mnt/win/rails/t4h_promo/vendor/plugins/restful_authentication/lib/authorization/aasm_roles.rb:9:in `included'
        from /mnt/win/rails/t4h_promo/app/models/user.rb:7:in `include'
        from /mnt/win/rails/t4h_promo/app/models/user.rb:7
        from /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/active_support/dependencies.rb:215:in `load_without_new_constant_marking'
        from /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/active_support/dependencies.rb:215:in `load_file'
        from /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/active_support/dependencies.rb:354:in `new_constants_in'
        from /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/active_support/dependencies.rb:214:in `load_file'
        from /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/active_support/dependencies.rb:95:in `require_or_load'
        from /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/active_support/dependencies.rb:260:in `load_missing_constant'
        from /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/active_support/dependencies.rb:467:in `const_missing'
        from /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/active_support/dependencies.rb:479:in `const_missing'
        from /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/active_support/inflector.rb:283:in `constantize'
        from /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/active_support/core_ext/string/inflections.rb:143:in `constantize'
        from /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/active_record/observer.rb:157:in `observed_class'
        from /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/active_record/observer.rb:183:in `observed_classes'
        from /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/active_record/observer.rb:166:in `initialize'
        from /usr/local/lib/ruby/1.8/singleton.rb:95:in `new'
        from /usr/local/lib/ruby/1.8/singleton.rb:95:in `instance'
        from /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/active_record/observer.rb:38:in `instantiate_observers'
        from /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/active_record/observer.rb:36:in `each'
        from /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/active_record/observer.rb:36:in `instantiate_observers'
        from /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/dispatcher.rb:26:in `define_dispatcher_callbacks'
        from /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/active_support/callbacks.rb:177:in `call'
        from /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/active_support/callbacks.rb:177:in `evaluate_method'
        from /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/active_support/callbacks.rb:161:in `call'
        from /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/active_support/callbacks.rb:90:in `run'
        from /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/active_support/callbacks.rb:90:in `each'
        from /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/active_support/callbacks.rb:90:in `send'
        from /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/active_support/callbacks.rb:90:in `run'
        from /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/active_support/callbacks.rb:272:in `run_callbacks'
        from /usr/local/lib/ruby/gems/1.8/gems/rails-2.1.0/lib/initializer.rb:483:in `send'
        from /usr/local/lib/ruby/gems/1.8/gems/rails-2.1.0/lib/initializer.rb:483:in `prepare_dispatcher'
        from /usr/local/lib/ruby/gems/1.8/gems/rails-2.1.0/lib/initializer.rb:151:in `process'
        from /usr/local/lib/ruby/gems/1.8/gems/rails-2.1.0/lib/initializer.rb:93:in `send'
        from /usr/local/lib/ruby/gems/1.8/gems/rails-2.1.0/lib/initializer.rb:93:in `run'
        from /mnt/win/rails/t4h_promo/config/environment.rb:17
        from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require'
        from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `require'
        from /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/active_support/dependencies.rb:509:in `require'
        from /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/active_support/dependencies.rb:354:in `new_constants_in'
        from /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/active_support/dependencies.rb:509:in `require'
        from /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/rails.rb:147:in `rails'
        from /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/mongrel_rails:113:in `cloaker_'
        from /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel/configurator.rb:149:in `call'
        from /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel/configurator.rb:149:in `listener'
        from /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/mongrel_rails:99:in `cloaker_'
        from /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel/configurator.rb:50:in `call'
        from /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel/configurator.rb:50:in `initialize'
        from /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/mongrel_rails:84:in `new'
        from /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/mongrel_rails:84:in `run'
        from /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel/command.rb:212:in `run'
        from /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/mongrel_rails:281
        from /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/active_support/dependencies.rb:502:in `load'
        from /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/active_support/dependencies.rb:502:in `load'
        from /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/active_support/dependencies.rb:354:in `new_constants_in'
        from /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/active_support/dependencies.rb:502:in `load'
        from /usr/local/lib/ruby/gems/1.8/gems/rails-2.1.0/lib/commands/servers/mongrel.rb:64
        from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require'
        from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `require'
        from /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/active_support/dependencies.rb:509:in `require'
        from /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/active_support/dependencies.rb:354:in `new_constants_in'
        from /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/active_support/dependencies.rb:509:in `require'
        from /usr/local/lib/ruby/gems/1.8/gems/rails-2.1.0/lib/commands/server.rb:39
        from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require'
        from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `require'
        from ./script/server:3

Comments and changes to this ticket

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

Restful Authentication Generator

This widely-used plugin provides a foundation for securely managing user
authentication:
* Login / logout
* Secure password handling
* Account activation by validating email
* Account approval / disabling by admin
* Rudimentary hooks for authorization and access control.

http://github.com/technoweenie/restful-authentication/tree

People watching this ticket

Pages